package thesis.ramstorage.core;

public abstract class Node implements Fallible, Comparable<Node>
{
	
	/**
	 * Prefix of the parameters that defines protocols.
	 * @config
	 */
	protected int state;
	
	public static final String PAR_PROT = "protocol";
	
	/**
	 * Returns the <code>i</code>-th protocol in this node. If <code>i</code> 
	 * is not a valid protocol id
	 * (negative or larger than or equal to the number of protocols), then it throws
	 * IndexOutOfBoundsException.
	 */
	public Protocol getProtocol(int i) {
		return null;
	}
	
	/**
	 * Returns the number of protocols included in this node.
	 */
	public int protocolSize() {
		return 0;
	}
	
	/**
	* Returns the unique ID of the node. It is guaranteed that the ID is unique
	* during the entire simulation, that is, there will be no different Node
	* objects with the same ID in the system during one invocation of the JVM.
	* Preferably nodes
	* should implement <code>hashCode()</code> based on this ID. 
	*/
	public long getID() {
		return 0L;
	}

	public void setID(){
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}
        public boolean isUp() {
        // TODO Auto-generated method stub
            return (this.state == Fallible.OK || this.state == Fallible.HEAVYLOAD || this.state == Fallible.STARTING_UP);
        }
}
